<template>
	<view class="digitem">
		<view :class="item?'dig-node':'dig-node is-leaf'" v-for="(item,index) in list" :key="index">
			<view class="dig-node-label">
				<view class="dig-node-label-inner" v-if="item" @click="chooseItem(item)">
					<view class="dig-node-label-info">
						<view class="dis-node-title">
							<text class="dig-info-text">{{item.label.selforder.username}} </text>
						</view>
						<text style="display: block;">{{item.label.selforder.order_no}}</text>
						<hr><text style="display: block;">{{$t('index.bg')}}：{{item.label.selforder.number}}</text>
					</view>
				</view>
				<view class="dig-node-label-inner" v-else>
					{{$t('index.yq')}}
				</view>
			</view>
			<view class="dig-node-children" v-if="item && item.children && item.children.length > 0">
				<yRecursive @chooseItem="chooseItem" :list="item.children" />
			</view>
			<!-- 
			<view class="dig-node-children is-leaf" v-else>
				<view class="dig-node-label">
					<view class="dig-node-label-inner">
						邀请
					</view>
				</view>
				<view class="dig-node-label">
					<view class="dig-node-label-inner">
						邀请
					</view>
				</view>

			</view> -->
		</view>
	</view>
</template>

<script>
	import yRecursive from './y-recursive'
	export default {
		name: 'yRecursive',
		data() {
			return {

			}
		},
		components: {
			yRecursive
		},
		props: {
			list: {
				typeof: Array,
				default: []
			}
		},
		created() {},
		methods: {
			chooseItem(item) {
				this.$emit('chooseItem', item)
			}
		}
	}
</script>

<style lang="scss">
	.dig-node,
	.dig-node-children {
		position: relative;
		margin: 0;
		padding: 0;
		list-style-type: none;
	}

	.dig-node {
		padding-top: 0;
	}

	.dig-node {
		padding-top: 20px;
		display: table-cell;
		vertical-align: top;
	}



	.dig-node-label {
		position: relative;
		background-color: #f1f1f1;
		display: inline-block;
		margin: 0 10px;
	}

	.dig-node.collapsed,
	.dig-node.is-leaf {
		padding-left: 10px;
		padding-right: 10px;
	}

	.dig-node-children:before {
		content: "";
		position: absolute;
		top: 0;
		left: 50%;
		width: 0;
		height: 20px;
		border-left: 1px solid #ddd;
	}

	.org-tree-node:after {
		left: 50%;
		border-left: 1px solid #ddd;
	}

	.dig-node-children {
		padding-top: 20px;
		display: table;
	}

	.dig-node:after,
	.dig-node:before {
		content: "";
		position: absolute;
		top: 0;
		left: 0;
		width: 50%;
		height: 19px;
	}

	.dig-node:after {
		left: 50%;
		border-left: 1px solid #ddd;
	}

	.dig-node:not(:first-child):before,
	.dig-node:not(:last-child):after {
		border-top: 1px solid #ddd;
	}

	.dig-node-label-inner {
		padding: 10px 15px;
		box-shadow: 0 1px 5px #00000015;
	}

	.dig-node-label-info {
		min-width: 132px;
		height: 92px;
	}

	.dis-node-title {
		text-align: center;
		margin-bottom: 5px;
	}

	.dig-info-span {
		display: inline-block;
		margin-left: 10px;
	}

	.dig>.digitem>.dig-node::after {
		border-left: 0;
	}
</style>